<!DOCTYPE html>
<title>Geolocation On An Insecure Origin</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/get-host-info.js"></script>
<script>
if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) {
    window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.pathname;
} else {
    if (window.testRunner)
        testRunner.overridePreference("WebKitStrictPowerfulFeatureRestrictions", true);

    async_test(function() {
        navigator.geolocation.getCurrentPosition(
            this.step_func(function() {
                assert_unreached('getCurrentPosition should fail, but succeeded.');
                this.done();
            }),
            this.step_func(function(error) {
                assert_equals(error.message, 'Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).');
                this.done();
            }));
    }, 'getCurrentPosition');

    async_test(function() {
        navigator.geolocation.watchPosition(
            this.step_func(function() {
                assert_unreached('watchPosition should fail, but succeeded.');
                this.done();
            }),
            this.step_func(function(error) {
                assert_equals(error.message, 'Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).');
                this.done();
            }));
    }, 'watchPosition');
}
</script>
